package cn.bugstack.test;
import org.redisson.misc.Hash;

import java.util.*;

public class leetcodeTest{
    public static void main(String[] args){
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        ArrayList<Integer> nums = new ArrayList<>();
        for (int i = 0; i<n; i++){
            nums.add(in.nextInt());
        }

        HashMap<Integer, Integer> map = new HashMap<>();
        for (int num : nums){
            map.put(num, map.getOrDefault(num, 0)+1);
        }

        Boolean flag = true;
        int i = 1;
        int result = 0;
        int curCount = 0;
        while (flag){
            int count = map.getOrDefault(i, 0);
            if (count == 0){
                flag = false;
            }else{
                curCount = curCount==0 ? count : count*curCount;
                result += curCount;
                i++;
            }
        }
        System.out.println(result);



    }
}
